import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/public/public_get.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/public/public_date.dart';
import 'package:honeypotflutter/publicBussine/bussine_font.dart';
import 'package:honeypotflutter/publicBussine/bussine_image.dart';
import 'package:honeypotflutter/publicBussine/loginInfo/bussine_userInfo.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_button.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_card.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_item.dart';
import 'package:honeypotflutter/public/views/public_appBar.dart';
import 'package:honeypotflutter/public/views/public_scrollView.dart';
import 'logic.dart';

class AccountWithdrawAmountSuccessPage extends StatefulWidget {
  const AccountWithdrawAmountSuccessPage({Key? key}) : super(key: key);

  @override
  State<AccountWithdrawAmountSuccessPage> createState() => _AccountWithdrawAmountSuccessPageState();
}

class _AccountWithdrawAmountSuccessPageState extends State<AccountWithdrawAmountSuccessPage> {
  final AccountWithdrawAmountSuccessLogic logic = Get.put(AccountWithdrawAmountSuccessLogic());
  UserInfoLogic userInfoLogic = Get.find<UserInfoLogic>();
  double _monry = 0.00;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    /// 更新个人信息
    userInfoLogic.requestUserInfo();
    _monry = double.parse(Get.arguments);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: HLAppBar(
          navigationTitle: "提现",
        ),
        body: HLScrollView(
          padding: EdgeInsets.only(left: 16, right: 16, top: 16),
          children: [
            MGCard(
              padding: EdgeInsets.only(top: 30, bottom: 30),
              children: [
                Image.asset(MGImage.image("public_success"), width: 80),
                SizedBox(height: 20),
                Text(
                  "提现申请已提交",
                  style: TextStyle(
                    fontSize: MGFont.titleFont2,
                    color: MGColors.text1Color,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ],
            ),
            MGCard(
              margin: EdgeInsets.only(top: 20),
              children: [
                MGItems(
                  leadTitle: "提现信息",
                  leadStyle: TextStyle(
                    fontSize: MGFont.titleFont4,
                    color: MGColors.text1Color,
                    fontWeight: FontWeight.bold,
                  ),
                  showBottomSplit: true,
                ),
                MGItems(
                  leadTitle: "银行卡号",
                  trailingTitle: userInfoLogic.userInfo.bankAccount?.bankCardNumber,
                  showBottomSplit: true,
                ),
                MGItems(
                  leadTitle: "提现金额",
                  trailingTitle: "${_monry.toStringAsFixed(2)}元",
                  showBottomSplit: true,
                ),
                MGItems(
                  leadTitle: "到账金额",
                  trailingTitle: "${(_monry * (1 - (userInfoLogic.userInfo.withdrawFeeRate ?? 0.00))).toStringAsFixed(2)}元",
                  showBottomSplit: true,
                ),
                MGItems(
                  leadTitle: "申请时间",
                  trailingTitle: HLDate.hl_format(),
                  showBottomSplit: true,
                )
              ],
            )
          ],
        ),
        bottomNavigationBar: MGButton(
          title: "确定",
          padding: EdgeInsets.only(left: 30, right: 30, bottom: 30, top: 15),
          buttonAction: () {
            HLGet.back();
          },
        ));
  }

  @override
  void dispose() {
    Get.delete<AccountWithdrawAmountSuccessLogic>();
    super.dispose();
  }
}
